<?php
App::import('model','User');

class Login extends AppModel {

  public $useTable = false;
  public $name = 'login';
  public $validate = array(
      'email' => array(
            'rule' => array('email',true),
            'allowEmpty'=> false,
            'required'=>true,
            'message'=>'Specify a valid email address'    
      ),
      'password' => array(
          'required' => array(
              'rule'     => 'notEmpty',
              'required' => true,
              'message'  => 'Password is required'
          )
      )
  );

    function isValidLogin() {
    $retVal = false;
      $user = new User();
      $result = $user->find("first", array('conditions' => array("User.email" => $this->email, "User.password"=>$this->password)));
      $retVal = empty($result) ? false : true;
    return $retVal;
  }


}

?>
